﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Caching;
using System.Text;
using System.Threading.Tasks;

namespace LRT.Caching
{
    public class DistributedCache : IDistributedCache
    {
        // Gets a reference to the default MemoryCache instance. 
        private static ObjectCache cache = MemoryCache.Default;
        private static CacheItemPolicy policy = null;
        private static CacheEntryRemovedCallback removedCallback = null;
        private static CacheEntryUpdateCallback updatecallback = null;

        static DistributedCache()
        {
            policy = new CacheItemPolicy();
        }

        void TheRemovedCallback(CacheEntryRemovedArguments arguments)
        {

        }

        void TheUpdatecallback(CacheEntryUpdateArguments arguments)
        {

        }


        #region 接口

        public object this[string key]
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public void Add(string key, object cacheItem, TimeSpan span)
        {
            var policy = new CacheItemPolicy();
            policy.SlidingExpiration = span;
            policy.RemovedCallback = removedCallback;
            policy.UpdateCallback = updatecallback;
            cache.Add(key, cacheItem, policy);
            throw new NotImplementedException();
        }

        public void Add(string key, object cacheItem, DateTime dateTime)
        {
            throw new NotImplementedException();
        }

        public void Set(string key, object cacheItem, TimeSpan span)
        {
            throw new NotImplementedException();
        }

        public void Set(string key, object cacheItem, DateTime dateTime)
        {
            throw new NotImplementedException();
        }

        public void Remove(string key)
        {
            throw new NotImplementedException();
        }

        public object Get(string key)
        {
            throw new NotImplementedException();
        }

        public int Count()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
